package com.tbs.parkingsaleapp.SystemManager;

import android.app.Activity;
import android.content.pm.PackageManager;
import androidx.core.app.ActivityCompat;

public class PermissionRequester {
    public final static String[] permissions={
            "android.permission.INTERNET",
            "android.permission.CAMERA",
            "android.permission.ACCESS_NETWORK_STATE",
            "android.permission.ACCESS_WIFI_STATE",
            "android.permission.WRITE_EXTERNAL_STORAGE",
            "android.permission.READ_PHONE_STATE",
            "android.permission.ACCESS_FINE_LOCATION",
            "android.permission.ACCESS_COARSE_LOCATION",
            "android.permission.CHANGE_WIFI_STATE",
            "android.permission.CHANGE_NETWORK_STATE",
            "android.permission.BLUETOOTH",
            "android.permission.BLUETOOTH_ADMIN",
            "android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"





    };

    //然后通过一个函数来申请
    public static void verifyStoragePermissions(Activity activity,String[] permissions) {
        for (String i:permissions
             ) {
            try {
                //检测是否有写的权限
                int permission = ActivityCompat.checkSelfPermission(activity,i);
                if (permission != PackageManager.PERMISSION_GRANTED) {
                    ActivityCompat.requestPermissions(activity,permissions,1);
                }
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

    }
}

